package 牛客小白月赛94;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class D小苯的排列构造 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n + 10];
		int[] ret = new int[n + 10];
		
		boolean flag1 = false;
		boolean flag2 = false;
		List<Integer>lis = new ArrayList(); // 这里面存的都是偶数
		
		int gs = 0;
		for(int i = 1; i <= n; i ++ ) {
			a[i] = sc.nextInt();
			// 一定是不增的
			if(a[i] > a[i - 1] && i != 1) {
				System.out.print(-1);
				return;
			}
			if(a[i] == 1) {
				gs ++ ;
			}
			if(i % 2 == 0) {
				lis.add(i);
			}
			if(n == 1) {
				System.out.print(a[1]);
				return ;
			}
			if(a[i] > n) {
				System.out.print(-1);
				return ;
			}
		}
		//要注意对1的特判
		if(gs < n / 2) {
			System.out.print(-1);
			return ;
		}
		boolean[] mp = new boolean[n + 10];
		ret[1] = a[1];
		mp[a[1]] = true;

		
		
		int j = 1;
		int dd = 0;
		int dd2 = ret[1];
		int cs = 2;
		
		int tt = 1;
		for(int i = 2; i <= n; i ++ ) {
			if(a[i] == 1) {
			//	System.out.print("ii = " + i + "\n");
				if(j <= n) { //把奇数输出
					while(mp[j] == true) {
						j = tt * 2 + 1;
						tt ++ ;
					}
					if(j <= n) {
						ret[i] = j;
						mp[j] = true;
					} else {
						while(dd < lis.size() && mp[lis.get(dd)] == true) {
							dd ++ ;
							if(dd >= lis.size()) {
								System.out.print(-1);
								return;
							}
						}
						mp[lis.get(dd)] = true;
						ret[i] = lis.get(dd);
					}
					
				//	System.out.print("j = " + j + "\n");
					
				} else {
					//System.out.print("i = " + i + "\n");
					while(dd < lis.size() && mp[lis.get(dd)] == true) {
						dd ++ ;
						if(dd >= lis.size()) {
							System.out.print(-1);
							return;
						}
					}
					mp[lis.get(dd)] = true;
					ret[i] = lis.get(dd);
				}
			} else {
				//System.out.print("i = " + i  + "\n");
				
				if(a[i] == a[i - 1]) { // 等于
					dd2 = a[i - 1];
					while(mp[dd2 * cs] == true) {
						cs ++;
						//System.out.print("cs = " + cs + "\n");
						if(dd2 * cs > n) {
							System.out.print(-1);
							return ;
						}
					}
					if(dd2 * cs > n) {
						System.out.print(-1);
						return ;
					}
				//	System.out.print("dd2 * cs = " + dd2 * cs + "\n");
					mp[dd2 * cs] = true;
					ret[i] = dd2 * cs;
				} else { // 这种只能是小于的情况
				//	System.out.print("???????????\n");
					
					if(ret[i - 1] % a[i] != 0) { // 比如 
						//5
						// 5 2 1 1 1 
						System.out.print(-1);
						return ;
					}
					ret[i] = a[i];
					mp[a[i]] = true;
					//解决掉这一步 就可以了吧
				}
			}
		}
		
		
		for(int i = 1; i <= n; i ++ ) {
			System.out.print(ret[i] + " ");
		}
	}
}
/**
6
4 2 2 1 1 1

8
8 4 2 1 1 1 1 1

 **/
